define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'user.leaveamessage/index',
        add_url: 'user.leaveamessage/add',
        edit_url: 'user.leaveamessage/edit',
        delete_url: 'user.leaveamessage/delete',
        export_url: 'user.leaveamessage/export',
        modify_url: 'user.leaveamessage/modify',
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                toolbar: ['refresh'],
                cols: [[
                    {field: 'id', title: 'id', search: false},
                    {field: 'titlt', title: '车辆名称', search: false},
                    {field: 'merchant_name', title: '商户名称', search: false},
                    {field: 'nickname', title: '用户昵称', search: false},
                    // {field: 'user_content', title: '用户留言'},
                    // {field: 'user_time', title: '用户留言时间'},
                    {field: '', title: '用户留言', templet:function(d) {
                        if (d.user_content) {
                            return d.user_content;
                        }else{
                            return "";
                        }
                    }},
                    {field: '', title: '用户留言时间', templet:function(d) {
                        if (d.user_content) {
                            return d.user_time;
                        }else{
                            return "";
                        }
                    }},
      
                    {field: '', title: '商户回复', templet:function(d) {
                        if (d.merchant_content) {
                            return d.merchant_content;
                        }else{
                            return "";
                        }
                    }},
                    {field: '', title: '商户回复时间', templet:function(d) {
                        if (d.merchant_content) {
                            return d.merchant_time;
                        }else{
                            return "";
                        }
                    }},
                    //{field: 'merchant_content', title: '商户回复'},
                   // {field: 'merchant_time', title: '商户回复时间'},
                    {field: 'status', title: '是否已读',selectList: {0: '未读',1: '已读'}},
                    {
                        width: 250,
                        title: '操作',
                        templet: ea.table.tool,
                        operat: [
                            // [
                            //     {
                            //         text: '查看详情',
                            //         url: init.edit_url,
                            //         method: 'open',
                            //         auth: 'edit',
                            //         class: 'layui-btn layui-btn-success layui-btn-xs',
                            //         extend: 'data-full="true"',
                            //     }
                            // ],
                            'delete'
                        ]
                    }

                ]],
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
    };
    return Controller;
});